import axios from 'axios';


// 告警统计
export const getAlarmStatistics = (sceneId: number) => {
  return axios.get(`/api/v1/sceneBoard/alarmStatistics`, {
    params: { sceneId }
  });
};

// 告警详情
export const getAlarmDetails = (sceneId: number, page?: number, size?: number) => {
  return axios.get(`/api/v1/sceneBoard/alarmDetails`, {
    params: { sceneId, page, size }
  });
};

// 告警趋势
export const getAlarmTrend = (sceneId: number) => {
  return axios.get(`/api/v1/sceneBoard/alarmTrend`, {
    params: { sceneId }
  });
};

// 设备状态
export const getDeviceStatus = (sceneId: number) => {
  return axios.get(`/api/v1/sceneBoard/sceneDeviceStatus`, {
    params: {
      sceneId,
      // showAll: 1
    }
  });
};

// 月度能耗
export const getMonthlyEnergyConsumption = (sceneId: number) => {
  return axios.get(`/api/v1/sceneBoard/monthlyEnergyConsumption`, {
    params: { sceneId }
  });
};

// 节能历史
export const getEnergySavingHistory = (sceneId: number) => {
  return axios.get(`/api/v1/sceneBoard/energySavingHistory`, {
    params: { sceneId }
  });
};

// 设备能耗占比
export const getDeviceConsumptionRatio = (sceneId: number) => {
  return axios.get(`/api/v1/sceneBoard/deviceConsumptionRatio`, {
    params: { sceneId }
  });
};

// 指标分析
export const getMetricTsd = ({ metricId, dim, start, aggUnit }: { metricId: number, dim: string, start: string, aggUnit: string }) => {
  return axios.get(`/api/v1/metric/tsd`, {
    params: { metricId, dim, start, aggUnit }
  });
};


// 场景指标
export const getSceneMetric = (sceneId: number) => {
  return axios.get(`/api/v1/scene/metric`, {
    params: { sceneId }
  });
};


// 场景指标数据
export const getSceneMetricData = ({ sceneId, metricId, dim, start, endTime, valueType, aggUnit }: { sceneId: number, metricId: number, dim: string, start: string, endTime: string, valueType: string, aggUnit: string }) => {
  return axios.get(`/api/v1/metric/tsd`, {
    params: { sceneId, metricId, dim, start, endTime, valueType, aggUnit }
  });
};
